package cn.edu.nuc.ssm.services.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.nuc.ssm.dao.AdminMapper;
import cn.edu.nuc.ssm.entity.Admin;
import cn.edu.nuc.ssm.services.interfaces.AdminService;

@Service
public class AdminServiceImpl implements AdminService {

	@Autowired
	private AdminMapper adminMapper;
	
	@Override
	public Admin login(String aname,String apwd) {
		
		
		
		Admin ad = adminMapper.selectByPrimaryName(aname);
		if( ad == null ||( ! apwd.equals( ad.getApwd() ) )){
			throw new RuntimeException("用户名密码错误");
		} 
		return ad;
	}
	

}
